package com.blueocean_health.care.management.controller.app;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.blueocean_health.care.management.common.LocalManager;
import com.blueocean_health.care.management.domain.base.SysResult;
import com.blueocean_health.care.management.domain.base.SysResultByPage;
import com.blueocean_health.care.management.domain.base.UserPatient;
import com.blueocean_health.care.management.domain.dto.AppOrderSelectInfoEntity;
import com.blueocean_health.care.management.domain.dto.AppOrderSelectStatusEntity;
import com.blueocean_health.care.management.domain.dto.AppSelectOrderInfoDto;
import com.blueocean_health.care.management.domain.ordervo.SelectOrderVo;
import com.blueocean_health.care.management.em.LocalManagerType;
import com.blueocean_health.care.management.service.IAppOrderSelectService;
import com.github.pagehelper.PageInfo;

@RestController
@RequestMapping(value = "app/order")
public class AppOrderSelectHandler{
	@Resource
	private IAppOrderSelectService iOrderSelectService;
	//手机端订单列表接口
	@RequestMapping(value = "list")
	public SysResult appSelectOrderList(@RequestBody(required = false)SelectOrderVo order) {
		UserPatient user = LocalManager.getVal(LocalManagerType.USER_APP);
		order.setLoginPhone(user.getPhone());
		PageInfo<AppOrderSelectInfoEntity> appSelectOrderList = iOrderSelectService.appSelectOrderList(order);
		return SysResultByPage.ok(appSelectOrderList.getList(),appSelectOrderList.getTotal());
		
	} 
	@RequestMapping(value = "query")
	public SysResult appSelectOrderInfo(@RequestBody SelectOrderVo order){
		AppSelectOrderInfoDto appSelectOrderInfo = iOrderSelectService.appSelectOrderInfo(order);
		return SysResult.ok(appSelectOrderInfo);
	}
	@RequestMapping(value = "queryStatus")
	public SysResult appSelectOrderStatus(@RequestBody SelectOrderVo order){
		 AppOrderSelectStatusEntity appSelectOrderStatus = iOrderSelectService.appSelectOrderStatus(order);
		return SysResult.ok(appSelectOrderStatus);
	}
}
